import * as dotenv from 'dotenv'

const envFound = dotenv.config({ path: ".env" })

if (envFound.error) {
  throw new Error("⚠️  Couldn't find .env file  ⚠️")
}

// tslint:disable-next-line:no-default-export
export default {

  host: process.env.HOST || 'localhost',
  port: parseInt(process.env.PORT || "8080"),

  database: {
    host: process.env.DATABASE_HOST || "localhost",
    user: process.env.DATABASE_USER || "root",
    password: process.env.DATABASE_PASSWORD || "root",
    port: parseInt(process.env.DATABASE_PORT || "3306")
  },

  status: {
    success: parseInt(process.env.STATUS_SUCCESS || '200'),
    fail: parseInt(process.env.STATUS_FAIL || '-1'),
    notFound: parseInt(process.env.STATUS_NOT_FOUND || '404')
  }
}
